package de.htw.praxisprojekt.data.draw;

import java.util.List;

import de.htw.praxisprojekt.AlgoData;
import de.htw.praxisprojekt.Vector2D;
import de.htw.praxisprojekt.data.AlgoPoint;

public class DrawUtils{
	public static void drawBasicLines(AlgoData algoData){
		List<AlgoPoint> algoPoints=algoData.getAlgoPoints();
		List<DrawObject> drawObjects=algoData.getDrawObjects();
		for(int i=1;i<algoPoints.size();++i){
			Vector2D fromPoint=algoPoints.get(i-1).getPoint();
			Vector2D toPoint=algoPoints.get(i).getPoint();
			drawObjects.add(new DrawLine(fromPoint,toPoint).setDashed(true));
		}
	}

	public static void drawBasicPoints(AlgoData algoData){
		List<AlgoPoint> algoPoints=algoData.getAlgoPoints();
		List<DrawObject> drawObjects=algoData.getDrawObjects();
		for(int i=0;i<algoPoints.size();++i){
			Vector2D algoPoint=algoPoints.get(i).getPoint();
			drawObjects.add(new DrawPoint(algoPoint));
			if(algoData.isStringDrawEnable())
				drawObjects.add(new DrawString("P"+i,algoPoint.x+10,algoPoint.y+10));
		}
	}
}